

   ****************************************
   * INDEX CONSTRUCTIONS *
   ****************************************
   * Creating wave averages*

* Econvars*
   group_mean ,  inputvars($econvars) suffixout(stav) suffixin(e) id(partid) groupvar(round) groups(1 2)
   group_mean ,  inputvars($econvars) suffixout(ltav) suffixin(e) id(partid) groupvar(round) groups(5 6)
   group_mean ,  inputvars($econvars) suffixout(tyav) suffixin(e) id(partid) groupvar(round) groups(7 8)

   group_mean ,  inputvars($wealthvars) suffixout(stav) suffixin(e) id(partid) groupvar(round) groups(1 2)
   group_mean ,  inputvars($wealthvars) suffixout(ltav) suffixin(e) id(partid) groupvar(round) groups(5 6)
   group_mean ,  inputvars($wealthvars) suffixout(tyav) suffixin(e) id(partid) groupvar(round) groups(7 8)

* Identity*
   group_mean ,  inputvars($identityvars) suffixout(stav) suffixin(e) id(partid) groupvar(round) groups(1 2)
   group_mean ,  inputvars($identityvars) suffixout(ltav) suffixin(e) id(partid) groupvar(round) groups(5 6)
   group_mean ,  inputvars($identityvars) suffixout(tyav) suffixin(e) id(partid) groupvar(round) groups(7 8)

* Bad behavior*
   group_mean ,  inputvars($asbvars) suffixout(stav) suffixin(e) id(partid) groupvar(round) groups(1 2)
   group_mean ,  inputvars($asbvars) suffixout(ltav) suffixin(e) id(partid) groupvar(round) groups(5 6)
   group_mean ,  inputvars($asbvars) suffixout(tyav) suffixin(e) id(partid) groupvar(round) groups(7 8)

* Social networks*
   group_mean ,  inputvars($socialvars) suffixout(stav) suffixin(e) id(partid) groupvar(round) groups(1 2)
   group_mean ,  inputvars($socialvars) suffixout(ltav) suffixin(e) id(partid) groupvar(round) groups(5 6)
   group_mean ,  inputvars($socialvars) suffixout(tyav) suffixin(e) id(partid) groupvar(round) groups(7 8)

* Self control vars*
   group_mean ,  inputvars($selfcontrolvars) suffixout(stav) suffixin(e) id(partid) groupvar(round) groups(1 2)
   group_mean ,  inputvars($selfcontrolvars) suffixout(ltav) suffixin(e) id(partid) groupvar(round) groups(5 6)
   group_mean ,  inputvars($selfcontrolvars) suffixout(tyav) suffixin(e) id(partid) groupvar(round) groups(7 8)

* Time preferences vars*
   group_mean ,  inputvars($timeprefvars) suffixout(stav) suffixin(e) id(partid) groupvar(round) groups(1 2)
   group_mean ,  inputvars($timeprefvars) suffixout(ltav) suffixin(e) id(partid) groupvar(round) groups(5 6)
   group_mean ,  inputvars($timeprefvars) suffixout(tyav) suffixin(e) id(partid) groupvar(round) groups(7 8)

* Substance abuse vars*
   group_mean ,  inputvars($substancevars) suffixout(stav) suffixin(e) id(partid) groupvar(round) groups(1 2)
   group_mean ,  inputvars($substancevars) suffixout(ltav) suffixin(e) id(partid) groupvar(round) groups(5 6)
   group_mean ,  inputvars($substancevars) suffixout(tyav) suffixin(e) id(partid) groupvar(round) groups(7 8)

* Mental health vars*
   group_mean ,  inputvars($mentalhvars) suffixout(stav) suffixin(e) id(partid) groupvar(round) groups(1 2)
   group_mean ,  inputvars($mentalhvars) suffixout(ltav) suffixin(e) id(partid) groupvar(round) groups(5 6)
   group_mean ,  inputvars($mentalhvars) suffixout(tyav) suffixin(e) id(partid) groupvar(round) groups(7 8)

* EF vars*
   group_mean ,  inputvars($efvars) suffixout(stav) suffixin(e) id(partid) groupvar(round) groups(1 2)
   group_mean ,  inputvars($efvars) suffixout(ltav) suffixin(e) id(partid) groupvar(round) groups(5 6)
   group_mean ,  inputvars($efvars) suffixout(tyav) suffixin(e) id(partid) groupvar(round) groups(7 8)


* Emphasis vars*
   group_mean ,  inputvars($emphasis) suffixout(g1_stav)   suffixin(g1_e)   id(partid) groupvar(round) groups(1 2)
   group_mean ,  inputvars($emphasis) suffixout(g15_stav)  suffixin(g15_e)  id(partid) groupvar(round) groups(1 2)
   group_mean ,  inputvars($emphasis) suffixout(g2_stav)   suffixin(g2_e)   id(partid) groupvar(round) groups(1 2)
   group_mean ,  inputvars($emphasis) suffixout(le1_stav)  suffixin(le1_e)  id(partid) groupvar(round) groups(1 2)
   group_mean ,  inputvars($emphasis) suffixout(le15_stav) suffixin(le15_e) id(partid) groupvar(round) groups(1 2)
   group_mean ,  inputvars($emphasis) suffixout(le2_stav)  suffixin(le2_e)  id(partid) groupvar(round) groups(1 2)

   group_mean ,  inputvars($emphasis) suffixout(g1_ltav)   suffixin(g1_e)   id(partid) groupvar(round) groups(5 6)
   group_mean ,  inputvars($emphasis) suffixout(g15_ltav)  suffixin(g15_e)  id(partid) groupvar(round) groups(5 6)
   group_mean ,  inputvars($emphasis) suffixout(g2_ltav)   suffixin(g2_e)   id(partid) groupvar(round) groups(5 6)
   group_mean ,  inputvars($emphasis) suffixout(le1_ltav)  suffixin(le1_e)  id(partid) groupvar(round) groups(5 6)
   group_mean ,  inputvars($emphasis) suffixout(le15_ltav) suffixin(le15_e) id(partid) groupvar(round) groups(5 6)
   group_mean ,  inputvars($emphasis) suffixout(le2_ltav)  suffixin(le2_e)  id(partid) groupvar(round) groups(5 6)

   group_mean ,  inputvars($emphasis) suffixout(g1_tyav)   suffixin(g1_e)   id(partid) groupvar(round) groups(7 8)
   group_mean ,  inputvars($emphasis) suffixout(g15_tyav)  suffixin(g15_e)  id(partid) groupvar(round) groups(7 8)
   group_mean ,  inputvars($emphasis) suffixout(g2_tyav)   suffixin(g2_e)   id(partid) groupvar(round) groups(7 8)
   group_mean ,  inputvars($emphasis) suffixout(le1_tyav)  suffixin(le1_e)  id(partid) groupvar(round) groups(7 8)
   group_mean ,  inputvars($emphasis) suffixout(le15_tyav) suffixin(le15_e) id(partid) groupvar(round) groups(7 8)
   group_mean ,  inputvars($emphasis) suffixout(le2_tyav)  suffixin(le2_e)  id(partid) groupvar(round) groups(7 8)




********************************************************************************
*** Contructing Fam Index for waves*********************************************
********************************************************************************


/**/
index_maker , indexname(uncens_fam_asb) indexlab("Antisocial Behaviors, uncens. version") inputvars(asbhostil_z_p disputes_all_z carryweapon drugssellever stealnb arrested domabuse_z_p) ///
              suffix(tyav) operation(mean) recenter keepstd(yes)
index_maker , indexname(fam_asb) indexlab("Antisocial Behaviors") inputvars(asbhostil_z_p cens_disputes_all_z_p carryweapon drugssellever stealnb arrested domabuse_z_p) ///
              suffix(tyav) operation(mean) recenter keepstd(yes)

index_maker , indexname(cens_fam_asb) indexlab("Antisocial Behaviors, cens. version") inputvars(asbhostil_z_p cens_disputes_all_z_p carryweapon drugssellever cens_stealnb arrested domabuse_z_p) ///
              suffix(tyav) operation(mean) recenter keepstd(yes)

index_maker , indexname(cens_fam_asb_ksf) indexlab("Antisocial Behaviors, cens. ksf version") inputvars(asbhostil_z_k cens_disputes_all_z_k carryweapon drugssellever cens_stealnb arrested domabuse_z_k) ///
              suffix(tyav) operation(mean) recenter keepstd(yes)
index_maker , indexname(cens_fam_asb_ss) indexlab("Antisocial Behaviors, cens. ss version") inputvars(asbhostil_z_ss cens_disputes_all_z_ss carryweapon drugssellever cens_stealnb arrested domabuse_z_ss) ///
              suffix(tyav) operation(mean) recenter keepstd(yes)



index_maker , indexname(fam_econ) indexlab("Economic performance") inputvars(profitsump99avg7d wealth_indexstd cstot2wusd savstockp99 homeless bizexptotp99 bizstocktotp99 houravg7d) ///
              suffix(tyav) operation(mean) recenter  rescale(homeless) keepstd(yes)
index_maker , indexname(fam_network) indexlab("Quality of social networks") inputvars(peerqualitystd famsupportindex patronlvl rel_commanders) ///
              suffix(tyav) operation(mean) recenter keepstd(yes)
index_maker , indexname(fam_mental) indexlab("Positive self-regard/mental health") inputvars(neuroticstd selfesteemstd wellbeing locuscontrstd depression distress) ///
              suffix(tyav) operation(mean) recenter rescale(neuroticstd depression distress) keepstd(yes)
index_maker , indexname(fam_identity) indexlab("Identity and values") inputvars(attviolence attcriminality politicalviol appearanceindex prosocialindex) ///
              suffix(tyav) operation(mean) recenter rescale(attviolence attcriminality politicalviol) keepstd(yes)
index_maker , indexname(timepref) indexlab("Forward-looking time preferences") inputvars(timedecl_p patient_game_real patient_game_decl patient_rate_dsct timedecl_t incon_game_real incon_game_decl incon_rate_dsct) ///
              suffix(tyav) operation(mean) recenter rescale(incon_game_real incon_game_decl incon_rate_dsct) keepstd(yes)
index_maker , indexname(selfcontrolnolo) indexlab("Self-control skills") inputvars(impulsivestd_resc rewardrespstd_resc conscientiousstd gritstd) ///
              suffix(tyav) operation(mean) recenter keepstd(yes)
index_maker , indexname(fam_subabuse) indexlab("Substance abuse") inputvars(drinkboozeever grassever harddrugsever) ///
              suffix(tyav) operation(mean) recenter keepstd(yes)
index_maker , indexname(mech_allexceptef) indexlab("Summary index of mechanisms, TP + SC + ID + 3") inputvars(timepref selfcontrolnolo fam_identity fam_mental subabuse fam_network) ///
              suffix(tyav) operation(mean) recenter



index_maker , indexname(fam_mental_pos) indexlab("Positive self-regard") inputvars(neuroticstd selfesteemstd wellbeing locuscontrstd) ///
              suffix(tyav) operation(mean) recenter rescale(neuroticstd)
index_maker , indexname(fam_mental_dep) indexlab("Depression and distress") inputvars(depression distress) ///
              suffix(tyav) operation(mean) recenter


index_maker , indexname(badbehavior_index) indexlab("Family Index: Bad Behaviors index (excludes dom. abuse)") inputvars(asbhostil_z_p disputes_all_z carryweapon drugssellever stealnb arrested) ///
              suffix(tyav) operation(mean) recenter
index_maker , indexname(success) indexlab("Family Index: Economic (Wealth and income)") inputvars(profitsump99avg7d cstot2wusd wealth_indexstd) ///
              suffix(tyav) operation(mean) recenter

index_maker , indexname(timepref_p) indexlab("Patience ($\delta$) summary index") inputvars(timedecl_p patient_game_real patient_game_decl patient_rate_dsct) ///
              suffix(tyav) operation(mean) recenter
index_maker , indexname(timepref_t) indexlab("Time inconsistency ($\beta$) summary index") inputvars(timedecl_t incon_game_real incon_game_decl incon_rate_dsct) ///
              suffix(tyav) operation(mean) recenter rescale(incon_game_real incon_game_decl incon_rate_dsct) /*More is more consistent*/
index_maker , indexname(timepref_real) indexlab("Incentivized trade-offs") inputvars( patient_game_real incon_game_real) ///
              suffix(tyav) operation(mean) recenter rescale(incon_game_real)

index_maker , indexname(sctp) indexlab("Self Control with Time Preferences") inputvars(personalitystd timepref) ///
              suffix(tyav) operation(mean) recenter
index_maker , indexname(scef) indexlab("Self Control with Executive Function") inputvars(personalitystd ef_score) ///
              suffix(tyav) operation(mean) recenter
index_maker , indexname(sctpef) indexlab("Self Control with Time Preferences and Executive Function") inputvars(personalitystd timepref ef_score) ///
              suffix(tyav) operation(mean) recenter


/**/


index_maker , indexname(fam_asb) indexlab("Antisocial Behaviors") inputvars(asbhostil_z_p cens_disputes_all_z_p carryweapon drugssellever stealnb arrested domabuse_z_p) ///
              suffix(ltav) operation(mean) recenter keepstd(yes)
index_maker , indexname(cens_fam_asb) indexlab("Antisocial Behaviors, cens. version") inputvars(asbhostil_z_p cens_disputes_all_z_p carryweapon drugssellever cens_stealnb arrested domabuse_z_p) ///
              suffix(ltav) operation(mean) recenter keepstd(yes)

index_maker , indexname(cens_fam_asb_ksf) indexlab("Antisocial Behaviors, cens. ksf version") inputvars(asbhostil_z_k cens_disputes_all_z_k carryweapon drugssellever cens_stealnb arrested domabuse_z_k) ///
              suffix(ltav) operation(mean) recenter keepstd(yes)
index_maker , indexname(cens_fam_asb_ss) indexlab("Antisocial Behaviors, cens. ss version") inputvars(asbhostil_z_ss cens_disputes_all_z_ss carryweapon drugssellever cens_stealnb arrested domabuse_z_ss) ///
              suffix(ltav) operation(mean) recenter keepstd(yes)



index_maker , indexname(fam_econ) indexlab("Economic Performance") inputvars(profitsump99avg7d wealth_indexstd cstot2wusd savstockp99 homeless bizexptotp99 bizstocktotp99 houravg7d) ///
              suffix(ltav) operation(mean) recenter  rescale(homeless) keepstd(yes)
index_maker , indexname(fam_network) indexlab("Quality of social networks") inputvars(peerqualitystd famsupportindex patronlvl rel_commanders) ///
              suffix(ltav) operation(mean) recenter keepstd(yes)
index_maker , indexname(fam_mental) indexlab("Positive self-regard/mental health") inputvars(neuroticstd selfesteemstd wellbeing locuscontrstd depression distress) ///
              suffix(ltav) operation(mean) recenter rescale(neuroticstd depression distress) keepstd(yes)
index_maker , indexname(fam_identity) indexlab("Identity and values") inputvars(attviolence attcriminality politicalviol appearanceindex prosocialindex) ///
              suffix(ltav) operation(mean) recenter rescale(attviolence attcriminality politicalviol) keepstd(yes)
index_maker , indexname(timepref) indexlab("Forward-looking time preferences") inputvars(timedecl_p patient_game_real patient_game_decl patient_rate_dsct timedecl_t incon_game_real incon_game_decl incon_rate_dsct) ///
              suffix(ltav) operation(mean) recenter rescale(incon_game_real incon_game_decl incon_rate_dsct) keepstd(yes)
index_maker , indexname(selfcontrolnolo) indexlab("Self-control skills") inputvars(impulsivestd_resc rewardrespstd_resc conscientiousstd gritstd) ///
              suffix(ltav) operation(mean) recenter keepstd(yes)
index_maker , indexname(fam_subabuse) indexlab("Substance Abuse") inputvars(drinkboozeever grassever harddrugsever) ///
              suffix(ltav) operation(mean) recenter keepstd(yes)

index_maker , indexname(mech_allexceptef) indexlab("Summary index of mechanisms, TP + SC + ID + 3") inputvars(timepref selfcontrolnolo fam_identity fam_mental subabuse fam_network) ///
              suffix(ltav) operation(mean) recenter


index_maker , indexname(fam_mental_pos) indexlab("Positive self-regard") inputvars(neuroticstd selfesteemstd wellbeing locuscontrstd) ///
              suffix(ltav) operation(mean) recenter rescale(neuroticstd)
index_maker , indexname(fam_mental_dep) indexlab("Depression and distress") inputvars(depression distress) ///
              suffix(ltav) operation(mean) recenter


index_maker , indexname(badbehavior_index) indexlab("Family Index: Bad Behaviors index (excludes dom. abuse)") inputvars(asbhostil_z_p disputes_all_z carryweapon drugssellever stealnb arrested) ///
              suffix(ltav) operation(mean) recenter
index_maker , indexname(success) indexlab("Family Index: Economic (Wealth and income)") inputvars(profitsump99avg7d cstot2wusd wealth_indexstd) ///
              suffix(ltav) operation(mean) recenter


index_maker , indexname(timepref_p) indexlab("Patience ($\delta$) summary index") inputvars(timedecl_p patient_game_real patient_game_decl patient_rate_dsct) ///
              suffix(ltav) operation(mean) recenter
index_maker , indexname(timepref_t) indexlab("Time inconsistency ($\beta$) summary index") inputvars(timedecl_t incon_game_real incon_game_decl incon_rate_dsct) ///
              suffix(ltav) operation(mean) recenter rescale(incon_game_real incon_game_decl incon_rate_dsct) /*More is more consistent*/
index_maker , indexname(timepref_real) indexlab("Incentivized trade-offs") inputvars( patient_game_real incon_game_real) ///
              suffix(ltav) operation(mean) recenter rescale(incon_game_real)

index_maker , indexname(sctp) indexlab("Self Control with Time Preferences") inputvars(personalitystd timepref) ///
              suffix(ltav) operation(mean) recenter
index_maker , indexname(scef) indexlab("Self Control with Executive Function") inputvars(personalitystd ef_score) ///
              suffix(ltav) operation(mean) recenter
index_maker , indexname(sctpef) indexlab("Self Control with Time Preferences and Executive Function") inputvars(personalitystd timepref ef_score) ///
              suffix(ltav) operation(mean) recenter


/**/

index_maker , indexname(fam_asb) indexlab("Antisocial Behaviors") inputvars(asbhostil_z_p cens_disputes_all_z_p carryweapon drugssellever stealnb arrested domabuse_z_p) ///
              suffix(stav) operation(mean) recenter keepstd(yes)
index_maker , indexname(cens_fam_asb) indexlab("Antisocial Behaviors, cens. version") inputvars(asbhostil_z_p cens_disputes_all_z_p carryweapon drugssellever cens_stealnb arrested domabuse_z_p) ///
              suffix(stav) operation(mean) recenter keepstd(yes)

index_maker , indexname(cens_fam_asb_ksf) indexlab("Antisocial Behaviors, cens. ksf version") inputvars(asbhostil_z_k cens_disputes_all_z_k carryweapon drugssellever cens_stealnb arrested domabuse_z_k) ///
              suffix(stav) operation(mean) recenter keepstd(yes)
index_maker , indexname(cens_fam_asb_ss) indexlab("Antisocial Behaviors, cens. ss version") inputvars(asbhostil_z_ss cens_disputes_all_z_ss carryweapon drugssellever cens_stealnb arrested domabuse_z_ss) ///
              suffix(stav) operation(mean) recenter keepstd(yes)


index_maker , indexname(fam_econ) indexlab("Economic Performance") inputvars(profitsump99avg7d wealth_indexstd cstot2wusd savstockp99 homeless bizexptotp99 bizstocktotp99 houravg7d) ///
              suffix(stav) operation(mean) recenter  rescale(homeless) keepstd(yes)
index_maker , indexname(fam_network) indexlab("Quality of social networks") inputvars(peerqualitystd famsupportindex patronlvl rel_commanders) ///
              suffix(stav) operation(mean) recenter keepstd(yes)
index_maker , indexname(fam_mental) indexlab("Positive self-regard/mental health") inputvars(neuroticstd selfesteemstd wellbeing locuscontrstd depression distress) ///
              suffix(stav) operation(mean) recenter rescale(neuroticstd depression distress) keepstd(yes)
index_maker , indexname(fam_identity) indexlab("Identity and values") inputvars(attviolence attcriminality politicalviol appearanceindex prosocialindex) ///
              suffix(stav) operation(mean) recenter rescale(attviolence attcriminality politicalviol) keepstd(yes)
index_maker , indexname(timepref) indexlab("Forward-looking time preferences") inputvars(timedecl_p patient_game_real patient_game_decl patient_rate_dsct timedecl_t incon_game_real incon_game_decl incon_rate_dsct) ///
              suffix(stav) operation(mean) recenter rescale(incon_game_real incon_game_decl incon_rate_dsct) keepstd(yes)
index_maker , indexname(selfcontrolnolo) indexlab("Self-control skills") inputvars(impulsivestd_resc rewardrespstd_resc conscientiousstd gritstd) ///
              suffix(stav) operation(mean) recenter keepstd(yes)
index_maker , indexname(fam_subabuse) indexlab("Substance Abuse") inputvars(drinkboozeever grassever harddrugsever) ///
              suffix(stav) operation(mean) recenter keepstd(yes)

index_maker , indexname(mech_allexceptef) indexlab("Summary index of mechanisms, TP + SC + ID + 3") inputvars(timepref selfcontrolnolo fam_identity fam_mental subabuse fam_network) ///
              suffix(stav) operation(mean) recenter




index_maker , indexname(fam_mental_pos) indexlab("Positive self-regard") inputvars(neuroticstd selfesteemstd wellbeing locuscontrstd) ///
              suffix(stav) operation(mean) recenter rescale(neuroticstd)
index_maker , indexname(fam_mental_dep) indexlab("Depression and distress") inputvars(depression distress) ///
              suffix(stav) operation(mean) recenter


index_maker , indexname(badbehavior_index) indexlab("Family Index: Bad Behaviors index (excludes dom. abuse)") inputvars(asbhostil_z_p disputes_all_z carryweapon drugssellever stealnb arrested) ///
              suffix(stav) operation(mean) recenter
index_maker , indexname(success) indexlab("Family Index: Economic (Wealth and income)") inputvars(profitsump99avg7d cstot2wusd wealth_indexstd) ///
              suffix(stav) operation(mean) recenter


index_maker , indexname(timepref_p) indexlab("Patience ($\delta$) summary index") inputvars(timedecl_p patient_game_real patient_game_decl patient_rate_dsct) ///
              suffix(stav) operation(mean) recenter
index_maker , indexname(timepref_t) indexlab("Time inconsistency ($\beta$) summary index") inputvars(timedecl_t incon_game_real incon_game_decl incon_rate_dsct) ///
              suffix(stav) operation(mean) recenter rescale(incon_game_real incon_game_decl incon_rate_dsct) /*More is more consistent*/
index_maker , indexname(timepref_real) indexlab("Incentivized trade-offs") inputvars( patient_game_real incon_game_real) ///
              suffix(stav) operation(mean) recenter rescale(incon_game_real)

index_maker , indexname(sctp) indexlab("Self Control with Time Preferences") inputvars(personalitystd timepref) ///
              suffix(stav) operation(mean) recenter
index_maker , indexname(scef) indexlab("Self Control with Executive Function") inputvars(personalitystd ef_score) ///
              suffix(stav) operation(mean) recenter
index_maker , indexname(sctpef) indexlab("Self Control with Time Preferences and Executive Function") inputvars(personalitystd timepref ef_score) ///
              suffix(stav) operation(mean) recenter




********************************************************************************
*** Emphasis Components*********************************************************
********************************************************************************

/*Enphasis components*/

 /*Short term*/
index_maker , indexname(badbehavior_index) indexlab("Standardized average of bad behaviors, (emphasis g1)") inputvars(asb hostility disputes stealnb arrested) ///
               suffix(g1_stav) operation(mean) recenter
index_maker , indexname(badbehavior_index) indexlab("Standardized average of bad behaviors, (emphasis g1.5)") inputvars(asb hostility disputes stealnb arrested) ///
               suffix(g15_stav) operation(mean) recenter
index_maker , indexname(badbehavior_index) indexlab("Standardized average of bad behaviors, (emphasis g2)") inputvars(asb hostility disputes stealnb arrested) ///
               suffix(g2_stav) operation(mean) recenter

index_maker , indexname(badbehavior_index) indexlab("Standardized average of bad behaviors, (emphasis le1)") inputvars(asb hostility disputes stealnb arrested) ///
               suffix(le1_stav) operation(mean) recenter
index_maker , indexname(badbehavior_index) indexlab("Standardized average of bad behaviors, (emphasis le1.5)") inputvars(asb hostility disputes stealnb arrested) ///
               suffix(le15_stav) operation(mean) recenter
index_maker , indexname(badbehavior_index) indexlab("Standardized average of bad behaviors, (emphasis le2)") inputvars(asb hostility disputes stealnb arrested) ///
               suffix(le2_stav) operation(mean) recenter

/**/
index_maker , indexname(violatt) indexlab("Index of attitudes toward violence and criminality, (emphasis g1)") inputvars(attcriminality attviolence politicalviol) ///
               suffix(g1_stav) operation(mean) recenter
index_maker , indexname(violatt) indexlab("Index of attitudes toward violence and criminality, (emphasis g1.5)") inputvars(attcriminality attviolence politicalviol) ///
               suffix(g15_stav) operation(mean) recenter
index_maker , indexname(violatt) indexlab("Index of attitudes toward violence and criminality, (emphasis g2)") inputvars(attcriminality attviolence politicalviol) ///
               suffix(g2_stav) operation(mean) recenter

index_maker , indexname(violatt) indexlab("Index of attitudes toward violence and criminality, (emphasis le1)") inputvars(attcriminality attviolence politicalviol) ///
               suffix(le1_stav) operation(mean) recenter
index_maker , indexname(violatt) indexlab("Index of attitudes toward violence and criminality, (emphasis le1.5)") inputvars(attcriminality attviolence politicalviol) ///
               suffix(le15_stav) operation(mean) recenter
index_maker , indexname(violatt) indexlab("Index of attitudes toward violence and criminality, (emphasis le2)") inputvars(attcriminality attviolence politicalviol) ///
               suffix(le2_stav) operation(mean) recenter

/**/
index_maker , indexname(personalitystd) indexlab("Standardized index of personality measures, (emphasis g1)") inputvars(impulsive  rewardresp conscientious grit) ///
               suffix(g1_stav) operation(mean) recenter rescale(impulsive rewardresp)
index_maker , indexname(personalitystd) indexlab("Standardized index of personality measures, (emphasis g1.5)") inputvars(impulsive  rewardresp conscientious grit) ///
               suffix(g15_stav) operation(mean) recenter rescale(impulsive rewardresp)
index_maker , indexname(personalitystd) indexlab("Standardized index of personality measures, (emphasis g2)") inputvars(impulsive  rewardresp conscientious grit) ///
               suffix(g2_stav) operation(mean) recenter rescale(impulsive rewardresp)

index_maker , indexname(personalitystd) indexlab("Standardized index of personality measures, (emphasis le1)") inputvars(impulsive  rewardresp conscientious grit) ///
               suffix(le1_stav) operation(mean) recenter rescale(impulsive rewardresp)
index_maker , indexname(personalitystd) indexlab("Standardized index of personality measures, (emphasis le1.5)") inputvars(impulsive  rewardresp conscientious grit) ///
               suffix(le15_stav) operation(mean) recenter rescale(impulsive rewardresp)
index_maker , indexname(personalitystd) indexlab("Standardized index of personality measures, (emphasis le2)") inputvars(impulsive  rewardresp conscientious grit) ///
               suffix(le2_stav) operation(mean) recenter rescale(impulsive rewardresp)

/*Long term*/

index_maker , indexname(badbehavior_index) indexlab("Standardized average of bad behaviors, (emphasis g1)") inputvars(asb hostility disputes stealnb arrested) ///
               suffix(g1_ltav) operation(mean) recenter
index_maker , indexname(badbehavior_index) indexlab("Standardized average of bad behaviors, (emphasis g1.5)") inputvars(asb hostility disputes stealnb arrested) ///
               suffix(g15_ltav) operation(mean) recenter
index_maker , indexname(badbehavior_index) indexlab("Standardized average of bad behaviors, (emphasis g2)") inputvars(asb hostility disputes stealnb arrested) ///
               suffix(g2_ltav) operation(mean) recenter

index_maker , indexname(badbehavior_index) indexlab("Standardized average of bad behaviors, (emphasis le1)") inputvars(asb hostility disputes stealnb arrested) ///
               suffix(le1_ltav) operation(mean) recenter
index_maker , indexname(badbehavior_index) indexlab("Standardized average of bad behaviors, (emphasis le1.5)") inputvars(asb hostility disputes stealnb arrested) ///
               suffix(le15_ltav) operation(mean) recenter
index_maker , indexname(badbehavior_index) indexlab("Standardized average of bad behaviors, (emphasis le2)") inputvars(asb hostility disputes stealnb arrested) ///
               suffix(le2_ltav) operation(mean) recenter

/**/
index_maker , indexname(violatt) indexlab("Index of attitudes toward violence and criminality, (emphasis g1)") inputvars(attcriminality attviolence politicalviol) ///
               suffix(g1_ltav) operation(mean) recenter
index_maker , indexname(violatt) indexlab("Index of attitudes toward violence and criminality, (emphasis g1.5)") inputvars(attcriminality attviolence politicalviol) ///
               suffix(g15_ltav) operation(mean) recenter
index_maker , indexname(violatt) indexlab("Index of attitudes toward violence and criminality, (emphasis g2)") inputvars(attcriminality attviolence politicalviol) ///
               suffix(g2_ltav) operation(mean) recenter

index_maker , indexname(violatt) indexlab("Index of attitudes toward violence and criminality, (emphasis le1)") inputvars(attcriminality attviolence politicalviol) ///
               suffix(le1_ltav) operation(mean) recenter
index_maker , indexname(violatt) indexlab("Index of attitudes toward violence and criminality, (emphasis le1.5)") inputvars(attcriminality attviolence politicalviol) ///
               suffix(le15_ltav) operation(mean) recenter
index_maker , indexname(violatt) indexlab("Index of attitudes toward violence and criminality, (emphasis le2)") inputvars(attcriminality attviolence politicalviol) ///
               suffix(le2_ltav) operation(mean) recenter

/**/
index_maker , indexname(personalitystd) indexlab("Standardized index of personality measures, (emphasis g1)") inputvars(impulsive  rewardresp conscientious grit) ///
               suffix(g1_ltav) operation(mean) recenter rescale(impulsive rewardresp)
index_maker , indexname(personalitystd) indexlab("Standardized index of personality measures, (emphasis g1.5)") inputvars(impulsive  rewardresp conscientious grit) ///
               suffix(g15_ltav) operation(mean) recenter rescale(impulsive rewardresp)
index_maker , indexname(personalitystd) indexlab("Standardized index of personality measures, (emphasis g2)") inputvars(impulsive  rewardresp conscientious grit) ///
               suffix(g2_ltav) operation(mean) recenter rescale(impulsive rewardresp)

index_maker , indexname(personalitystd) indexlab("Standardized index of personality measures, (emphasis le1)") inputvars(impulsive  rewardresp conscientious grit) ///
               suffix(le1_ltav) operation(mean) recenter rescale(impulsive rewardresp)
index_maker , indexname(personalitystd) indexlab("Standardized index of personality measures, (emphasis le1.5)") inputvars(impulsive  rewardresp conscientious grit) ///
               suffix(le15_ltav) operation(mean) recenter rescale(impulsive rewardresp)
index_maker , indexname(personalitystd) indexlab("Standardized index of personality measures, (emphasis le2)") inputvars(impulsive  rewardresp conscientious grit) ///
               suffix(le2_ltav) operation(mean) recenter rescale(impulsive rewardresp)

/*10 Years*/


index_maker , indexname(badbehavior_index) indexlab("Standardized average of bad behaviors, (emphasis g1)") inputvars(asb hostility disputes stealnb arrested) ///
               suffix(g1_tyav) operation(mean) recenter
index_maker , indexname(badbehavior_index) indexlab("Standardized average of bad behaviors, (emphasis g1.5)") inputvars(asb hostility disputes stealnb arrested) ///
               suffix(g15_tyav) operation(mean) recenter
index_maker , indexname(badbehavior_index) indexlab("Standardized average of bad behaviors, (emphasis g2)") inputvars(asb hostility disputes stealnb arrested) ///
               suffix(g2_tyav) operation(mean) recenter

index_maker , indexname(badbehavior_index) indexlab("Standardized average of bad behaviors, (emphasis le1)") inputvars(asb hostility disputes stealnb arrested) ///
               suffix(le1_tyav) operation(mean) recenter
index_maker , indexname(badbehavior_index) indexlab("Standardized average of bad behaviors, (emphasis le1.5)") inputvars(asb hostility disputes stealnb arrested) ///
               suffix(le15_tyav) operation(mean) recenter
index_maker , indexname(badbehavior_index) indexlab("Standardized average of bad behaviors, (emphasis le2)") inputvars(asb hostility disputes stealnb arrested) ///
               suffix(le2_tyav) operation(mean) recenter

/**/
index_maker , indexname(violatt) indexlab("\quad{Topics emphasized in curriculum (8)}") inputvars(attcriminality attviolence politicalviol) ///
               suffix(g1_tyav) operation(mean) recenter
index_maker , indexname(violatt) indexlab("Index of attitudes toward violence and criminality, (emphasis g1.5)") inputvars(attcriminality attviolence politicalviol) ///
               suffix(g15_tyav) operation(mean) recenter
index_maker , indexname(violatt) indexlab("Index of attitudes toward violence and criminality, (emphasis g2)") inputvars(attcriminality attviolence politicalviol) ///
               suffix(g2_tyav) operation(mean) recenter

index_maker , indexname(violatt) indexlab("\quad{Topics not emphasized in curriculum (12)}") inputvars(attcriminality attviolence politicalviol) ///
               suffix(le1_tyav) operation(mean) recenter
index_maker , indexname(violatt) indexlab("Index of attitudes toward violence and criminality, (emphasis le1.5)") inputvars(attcriminality attviolence politicalviol) ///
               suffix(le15_tyav) operation(mean) recenter
index_maker , indexname(violatt) indexlab("Index of attitudes toward violence and criminality, (emphasis le2)") inputvars(attcriminality attviolence politicalviol) ///
               suffix(le2_tyav) operation(mean) recenter

/**/
index_maker , indexname(personalitystd) indexlab("\quad{Topics emphasized in curriculum (16)}") inputvars(impulsive  rewardresp conscientious grit) ///
               suffix(g1_tyav) operation(mean) recenter rescale(impulsive rewardresp)
index_maker , indexname(personalitystd) indexlab("Standardized index of personality measures, (emphasis g1.5)") inputvars(impulsive  rewardresp conscientious grit) ///
               suffix(g15_tyav) operation(mean) recenter rescale(impulsive rewardresp)
index_maker , indexname(personalitystd) indexlab("Standardized index of personality measures, (emphasis g2)") inputvars(impulsive  rewardresp conscientious grit) ///
               suffix(g2_tyav) operation(mean) recenter rescale(impulsive rewardresp)

index_maker , indexname(personalitystd) indexlab("\quad{Topics not emphasized in curriculum (16)}") inputvars(impulsive  rewardresp conscientious grit) ///
               suffix(le1_tyav) operation(mean) recenter rescale(impulsive rewardresp)
index_maker , indexname(personalitystd) indexlab("Standardized index of personality measures, (emphasis le1.5)") inputvars(impulsive  rewardresp conscientious grit) ///
               suffix(le15_tyav) operation(mean) recenter rescale(impulsive rewardresp)
index_maker , indexname(personalitystd) indexlab("Standardized index of personality measures, (emphasis le2)") inputvars(impulsive  rewardresp conscientious grit) ///
               suffix(le2_tyav) operation(mean) recenter rescale(impulsive rewardresp)

/*
   foreach p in stav ltav tyav {
      foreach x in  timepref_p timepref_t impulsivestd  rewardrespstd ///
      drinkboozeever grassever harddrugsever  {
         sum `x'_`p'
         gen Z_`x'_std_`p' = (`x'_`p'-r(mean))/r(sd)
           cap label var Z_`x'_std_`p' `"`: variable label `x'_`p''"'
         }
      foreach x in  impulsivestd rewardrespstd drinkboozeever grassever harddrugsever {
         replace  Z_`x'_std_`p' = - Z_`x'_std_`p'

      }
      ren (Z_*) (*)
   }
